<script type='text/javascript'>

	var tools = {};
	tools.post = function(url, data, callback){
		$.post(url, data, function(data) { callback(data); });
	}
	tools.load = function(url) {
		$('#compute-tax #compute-tax-result').fadeOut(function(){
			$('#compute-tax #compute-tax-result').load(url, function() {
				$('#compute-tax #compute-tax-result').fadeIn();
			});	
		});
	}
	function compute() {
		tools.load('/services/tools/computetax?startDate='  + $('#compute-tax #startDate').val() +
		                                     '&endDate='    + $('#compute-tax #endDate').val(), function(){
		});
	}
	
	function export(){
		$('#io-box').load('/services/tools/appdata', function() {		 
		});	
	}
	function import() {
		if(confirm('are you sure? this will preform a conditional update, if records are found, it will update, otherwise it will create. it is advised to first backup any existing data prior to running an import')){
		$.post('/services/tools/appdata', {data: $('#io-box').val()}, function(data) {
			alert(data);
		});}
	}
	function email(){
		if(confirm('will send to the personal.email address, ok to send')){
		$('#io-box').load('/services/tools/emailbackup', function() {	
			
		});	
		}
	}
</script>

<div id='menu'>

</div>

<div id='content'>
	<h1>tools</h1>
	<div id='compute-tax'>
		<fieldset>
			<legend>compute tax</legend>
			<div class='field-row'>
				<label>start</label>
				<input type='text' id='startDate' class='date-field' /> 
			</div>
			<div class='field-row'>
				<label>end</label>
				<input type='text' id='endDate' class='date-field' />
			</div>
			<div class='field-row'>
				<label>&nbsp;</label>
				<a href='javascript:compute()'>compute</a>
			</div>	
			<div  class='field-row' id='compute-tax-result'>

			</div>
		</fieldset>

	</div>
	
	<div id='exporter'>
		<fieldset>
			<legend>backups and imports</legend>
			<div class='field-row'>
			<a href='javascript:export()'>export</a>
			<a href='javascript:import()'>import</a>
			<a href='javascript:email()'>email an export</a>
			</div>
				<div class='field-row'>
				<textarea id='io-box' style='width:95%'></textarea>
			</div>
		</fieldset>
	</div>
	
	
</div>